package com.lbn.jfqsc.app.home.adapter;

import android.content.Context;
import android.widget.ImageView;
import android.widget.TextView;

import com.lbn.baseframe.base.BaseRecyclerAdapter;
import com.lbn.baseframe.base.RecyclerViewHolder;
import com.lbn.baseframe.image.LoaderImage;
import com.lbn.baseframe.utils.DateUtils;
import com.lbn.jfqsc.R;
import com.lbn.jfqsc.business.bean.Goods;

import java.util.List;

import butterknife.BindView;
import de.hdodenhof.circleimageview.CircleImageView;

/**
 * @author 李炳南
 * @date 2017/2/28
 */
public class HomeItemAdapter extends BaseRecyclerAdapter<Goods> {


    public HomeItemAdapter(Context ctx, List<Goods> list) {
        super(ctx, list);
    }

    @Override
    public int getItemLayoutId(int viewType) {
        return R.layout.layout_item_home;
    }

    @Override
    public void bindData(RecyclerViewHolder holder, int position, Goods item) {
        CircleImageView head = holder.getView(R.id.head);
        TextView name = holder.getView(R.id.name);
        TextView time = holder.getView(R.id.time);
        ImageView goodImage = holder.getView(R.id.good_image);
        LoaderImage.displayImage(item.getUserHead(),head);
        LoaderImage.displayImage(item.getGoodsImg(),goodImage);
        name.setText(item.getUserName());
        time.setText("发表于 "+DateUtils.stampToDate(item.getDate()));
    }

}
